package com.ysy.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;


import java.util.Arrays;

import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum LoginTypeEnum {

    VERIFICATION_CODE(1,"验证码"),
    PASSWORD(2,"密码");


    private Integer code;

    private String desc;

    private static Map<Integer,LoginTypeEnum> cacheMap;

    static {
        cacheMap = Arrays.stream(LoginTypeEnum.values()).collect(Collectors.toMap(LoginTypeEnum::getCode, e -> e));
    }

    public static LoginTypeEnum getLoginTypeEnum(Integer code) {
        return cacheMap.get(code);
    }
}
